Skip to content

修复了一些问题 - #647

Merged
wess09 merged 6 commits into
masterfrom
dev
Jul 27, 2026
Merged

修复了一些问题#647
wess09 merged 6 commits into
masterfrom
dev

Conversation

@wess09

@wess09 wess09 commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

处理进入仓库时误导航到任务界面的问题,并优化 D 级战斗结果的处理逻辑,避免将非船难战斗误判为船难,同时澄清情绪记录相关的行为。

Bug Fixes:

  • 防止在自动搜索的 D 级结算界面中,在未发生实际船难的情况下错误触发船难情绪惩罚或标记。
  • 处理在进入仓库时误入任务(情报)界面的情况,通过自动退出并以递增延迟重试来纠正。

Enhancements:

  • 记录并说明 FleetEmotion.valueFleetEmotion.record 的惰性属性行为,以澄清无需进行手动赋值。
Original summary in English

Summary by Sourcery

Handle misnavigation to mission screen when entering storage and refine handling of D-rank battle results to avoid misclassifying non-shipwreck battles as shipwrecks while clarifying emotion recording behavior.

Bug Fixes:

  • Prevent auto-search D-rank settlement screens from incorrectly triggering shipwreck mood penalties or flags when no actual shipwreck occurred.
  • Handle accidental entry into the mission (情报) screen during storage entry by backing out and retrying with incremental delays.

Enhancements:

  • Document the lazy property behavior of FleetEmotion.value and FleetEmotion.record to clarify that manual assignment is unnecessary.

longer-sausage and others added 6 commits July 27, 2026 21:00
fix #628

## Summary by Sourcery

Bug Fixes:
- 通过检测并在重试前自动退出回到地图界面,处理在访问世界存储期间意外进入情报界面的情况。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Bug Fixes:
- Handle accidental entry into the intel screen during world storage
access by detecting it and automatically exiting back to the map before
retrying.

</details>
1. 调整结算界面判断逻辑,仅在检测到OPTS_INFO_D弹窗时才标记沉船,避免S/A/B评价过渡帧误匹配
2. 修复emotion模块中舰队心情属性未同步更新的问题,确保心情恢复计算正确
调整了战斗结算界面的判断逻辑,不再在误匹配D评价模板时继续循环等待,而是直接退出当前战斗循环,由后续流程统一处理结算弹窗,确保沉船时的心情扣减逻辑正确触发。
## Summary by Sourcery

调整 D 级战斗结果的处理,避免将临时动画帧误判为实际的舰沉事件,并澄清情绪追踪的行为。

Bug 修复:
- 在标准战斗中,当更高评级的结算动画短暂出现与 D 级结算画面匹配的帧时,防止错误触发舰沉导致的情绪惩罚。
- 在联合自沉流程中,当短暂出现与 D 级结算画面匹配但未实际确认舰沉的情况时,防止错误设置舰沉标记。

增强:
- 明确舰队情绪记录的文档说明,解释基于属性的配置更新机制,避免冗余赋值。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Adjust D-rank battle result handling to avoid misclassifying temporary
animation frames as actual shipwrecks and clarify emotion tracking
behavior.

Bug Fixes:
- Prevent false shipwreck mood penalties in standard combat when D-rank
result screens are briefly matched during higher-rank result animations.
- Prevent false shipwreck flags in coalition scuttle flow when D-rank
result screens are briefly matched without actual shipwreck
confirmation.

Enhancements:
- Clarify documentation for fleet emotion recording to explain
property-based config updates and avoid redundant assignments.

</details>

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

调整 D 级战斗结果的处理,避免将临时动画帧误判为实际的舰沉事件,并澄清情绪追踪的行为。

Bug 修复:
- 在标准战斗中,当更高评级的结算动画短暂出现与 D 级结算画面匹配的帧时,防止错误触发舰沉导致的情绪惩罚。
- 在联合自沉流程中,当短暂出现与 D 级结算画面匹配但未实际确认舰沉的情况时,防止错误设置舰沉标记。

增强:
- 明确舰队情绪记录的文档说明,解释基于属性的配置更新机制,避免冗余赋值。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Adjust D-rank battle result handling to avoid misclassifying temporary
animation frames as actual shipwrecks and clarify emotion tracking
behavior.

Bug Fixes:
- Prevent false shipwreck mood penalties in standard combat when D-rank
result screens are briefly matched during higher-rank result animations.
- Prevent false shipwreck flags in coalition scuttle flow when D-rank
result screens are briefly matched without actual shipwreck
confirmation.

Enhancements:
- Clarify documentation for fleet emotion recording to explain
property-based config updates and avoid redundant assignments.

</details>

</details>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@wess09
wess09 merged commit 1c028de into master Jul 27, 2026
8 checks passed
@sourcery-ai

sourcery-ai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

调整战斗结果处理逻辑,以避免将短暂出现的 D 级结算画面误判为真实船沉;引入更安全的仓库进入流程,可在误触进入任务界面时通过带退避重试的方式恢复;并通过文档澄清情绪记录行为。

更新后 D 级战斗结果与情绪处理的时序图

sequenceDiagram
    participant AutoSearchCombat
    participant Emotion

    loop battle_result_polling
        AutoSearchCombat->>AutoSearchCombat: appear(OPTS_INFO_D)
        alt OPTS_INFO_D_detected
            AutoSearchCombat->>AutoSearchCombat: set _withdraw = True
            AutoSearchCombat->>AutoSearchCombat: set _is_shipwreck = True
            AutoSearchCombat->>Emotion: reduce(fleet_index, shipwreck=True)
            note right of AutoSearchCombat: break
        else D_rank_screen_only
            AutoSearchCombat->>AutoSearchCombat: appear(BATTLE_STATUS_D)
            AutoSearchCombat->>AutoSearchCombat: appear(EXP_INFO_D)
            opt BATTLE_STATUS_D_or_EXP_INFO_D_detected
                AutoSearchCombat->>AutoSearchCombat: set _withdraw = True
                note right of AutoSearchCombat: break
            end
        else timeout
            AutoSearchCombat->>AutoSearchCombat: confirm_timer.reached()
            opt confirm_timer_reached
                AutoSearchCombat->>AutoSearchCombat: set _withdraw = True
                note right of AutoSearchCombat: break
            end
        end
    end
    AutoSearchCombat->>AutoSearchCombat: auto_search_combat_status()
    AutoSearchCombat->>AutoSearchCombat: handle_battle_status()
Loading

File-Level Changes

Change Details Files
在进入仓库时增加防御性处理,用于从误触进入任务界面中恢复,并在重试之间采用递增等待时间。
  • 在进入仓库的循环之前初始化一个 wait_seconds 计数器。
  • 检测到误导航进入任务界面时,通过带验证的 ui_click 尝试返回地图,并使用 is_in_map 进行确认。
  • 每次恢复尝试后,递增地增加 sleep 时长,以避免快速频繁重试,然后继续循环。
  • 导入 time 模块以支持递增式休眠。
module/os_handler/storage.py
优化 D 级战斗结果处理,使只有通过 OPTS_INFO_D 确认的沉船才会触发沉船情绪惩罚和标记,而短暂出现的 D 模板仅用于退出轮询循环。
  • auto_search_combat 中,更新注释,记录真实沉船与短暂 D 级模板匹配之间的区别,并依赖 OPTS_INFO_D 来驱动情绪减少。
  • 移除对未被 OPTS_INFO_D 确认的 D 级结果帧的情绪减少;现在 D 模板只用于跳出确认循环,并将后续处理交给 auto_search_combat_status / handle_battle_status
  • coalition_scuttle 中,同样移除在普通 D 级结果帧上设置 _is_shipwreck 标记,仅在由 OPTS_INFO_D 确认的路径上保留沉船标记。
  • 在这两处战斗流程中扩展行内注释,以解释新的控制流程以及围绕模板误检与沉船处理的设计理由。
module/combat/auto_search_combat.py
module/coalition/coalition_scuttle.py
明确文档中关于 FleetEmotion.valueFleetEmotion.record 属性如何与底层配置交互,以避免不正确的手动赋值。
  • 扩展 FleetEmotion.record 的文档字符串,说明 valuerecord 是由 @property 支持的属性,并从 self.config 中读取。
  • 强调只需在 config 上设置属性即可,手动重新赋值这些属性本身是不必要的。
module/combat/emotion.py

Tips and commands

Interacting with Sourcery

  • 触发新一次代码审查: 在 Pull Request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub Issue: 在审查评论下回复,请求 Sourcery 从该评论创建一个 Issue。你也可以直接回复 @sourcery-ai issue 来从该评论创建 Issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题的任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 Pull Request 中评论 @sourcery-ai title 以(重新)生成标题。
  • 生成 Pull Request 摘要: 在 Pull Request 描述正文的任意位置写上 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在 Pull Request 中评论 @sourcery-ai summary 以在任意时间(重新)生成摘要。
  • 生成审查者指南: 在 Pull Request 中评论 @sourcery-ai guide,即可在任意时间(重新)生成审查者指南。
  • 一次性解决所有 Sourcery 评论: 在 Pull Request 中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理了所有评论且不想再看到它们,这会很有用。
  • 一次性关闭所有 Sourcery 审查: 在 Pull Request 中评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 审查。特别适用于你想从零开始进行新一轮审查的情况——别忘了再评论 @sourcery-ai review 触发新的审查!

Customizing Your Experience

访问你的 dashboard 来:

  • 启用或禁用审查功能,例如 Sourcery 自动生成的 Pull Request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查相关设置。

Getting Help

Original review guide in English

Reviewer's Guide

Adjusts combat result handling to avoid misclassifying transient D-rank frames as true shipwrecks, introduces a safer warehouse entry flow that recovers from accidentally opening the mission screen with backoff retries, and clarifies emotion recording behavior via documentation.

Sequence diagram for updated D-rank combat result and emotion handling

sequenceDiagram
    participant AutoSearchCombat
    participant Emotion

    loop battle_result_polling
        AutoSearchCombat->>AutoSearchCombat: appear(OPTS_INFO_D)
        alt OPTS_INFO_D_detected
            AutoSearchCombat->>AutoSearchCombat: set _withdraw = True
            AutoSearchCombat->>AutoSearchCombat: set _is_shipwreck = True
            AutoSearchCombat->>Emotion: reduce(fleet_index, shipwreck=True)
            note right of AutoSearchCombat: break
        else D_rank_screen_only
            AutoSearchCombat->>AutoSearchCombat: appear(BATTLE_STATUS_D)
            AutoSearchCombat->>AutoSearchCombat: appear(EXP_INFO_D)
            opt BATTLE_STATUS_D_or_EXP_INFO_D_detected
                AutoSearchCombat->>AutoSearchCombat: set _withdraw = True
                note right of AutoSearchCombat: break
            end
        else timeout
            AutoSearchCombat->>AutoSearchCombat: confirm_timer.reached()
            opt confirm_timer_reached
                AutoSearchCombat->>AutoSearchCombat: set _withdraw = True
                note right of AutoSearchCombat: break
            end
        end
    end
    AutoSearchCombat->>AutoSearchCombat: auto_search_combat_status()
    AutoSearchCombat->>AutoSearchCombat: handle_battle_status()
Loading

File-Level Changes

Change Details Files
Add defensive handling when entering storage to recover from accidentally opening the mission screen, with incremental wait between retries.
  • Initialize a wait_seconds counter before the storage entry loop.
  • Detect accidental navigation to the mission screen and attempt to exit back to the map using ui_click with validation via is_in_map.
  • After each recovery attempt, incrementally increase sleep duration to avoid rapid retries and then continue the loop.
  • Import the time module to support incremental sleeps.
module/os_handler/storage.py
Refine D-rank battle result handling so that only confirmed shipwrecks (via OPTS_INFO_D) trigger shipwreck emotion penalties and flags, while transient D templates merely exit the loop.
  • In auto_search_combat, update comments to document the distinction between true shipwrecks and transient D-rank template matches and rely on OPTS_INFO_D to drive emotion reduction.
  • Remove emotion reduction on D-rank result frames that are not confirmed by OPTS_INFO_D; now D templates only break out of the confirmation loop and delegate further handling to auto_search_combat_status/handle_battle_status.
  • In coalition_scuttle, similarly remove setting of the _is_shipwreck flag on plain D-rank result frames, keeping shipwreck marking only on the OPTS_INFO_D-confirmed path.
  • Extend inline comments in both combat flows to explain the new control flow and rationale around template misdetection and shipwreck handling.
module/combat/auto_search_combat.py
module/coalition/coalition_scuttle.py
Clarify documentation on how FleetEmotion.value and FleetEmotion.record properties interact with the underlying config to avoid incorrect manual assignments.
  • Expand the docstring of FleetEmotion.record to explain that value and record are @property-backed and read from self.config.
  • Note that setting attributes on config is sufficient and manual reassignment of the properties is unnecessary.
module/combat/emotion.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出了一些总体反馈:

  • storage_enter 中,wait_seconds 随着 time.sleep 递增,如果持续发生路径错误,等待时间可能会无限增长;建议对退避时间做上限,或者增加最大重试次数,以避免长时间阻塞睡眠导致潜在卡死。
  • D 级结算(D-rank settlement)的处理逻辑及其解释性注释在 auto_search_combat_executecoalition_scuttle.auto_search_combat_execute 中是重复的;建议将这部分抽取到一个共享的工具函数或常量中,以保持行为和设计理由的一致性。
面向 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- In `storage_enter`, the incrementally increasing `wait_seconds` with `time.sleep` can grow without bound if misnavigation keeps happening; consider capping the backoff or adding a maximum retry count to avoid long blocking sleeps and potential hangs.
- The D-rank settlement handling logic and its explanatory comments are duplicated between `auto_search_combat_execute` and `coalition_scuttle.auto_search_combat_execute`; consider extracting this into a shared helper or constant to keep behavior and rationale synchronized.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,请考虑分享给更多人 ✨
帮我变得更有用吧!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码评审。
Original comment in English

Hey - I've left some high level feedback:

  • In storage_enter, the incrementally increasing wait_seconds with time.sleep can grow without bound if misnavigation keeps happening; consider capping the backoff or adding a maximum retry count to avoid long blocking sleeps and potential hangs.
  • The D-rank settlement handling logic and its explanatory comments are duplicated between auto_search_combat_execute and coalition_scuttle.auto_search_combat_execute; consider extracting this into a shared helper or constant to keep behavior and rationale synchronized.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `storage_enter`, the incrementally increasing `wait_seconds` with `time.sleep` can grow without bound if misnavigation keeps happening; consider capping the backoff or adding a maximum retry count to avoid long blocking sleeps and potential hangs.
- The D-rank settlement handling logic and its explanatory comments are duplicated between `auto_search_combat_execute` and `coalition_scuttle.auto_search_combat_execute`; consider extracting this into a shared helper or constant to keep behavior and rationale synchronized.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants